# HG changeset patch
# User Bertrand Jacquin <bertrand@jacquin.bzh>
# Date 1444431941 -3600
# Node ID 5c6d2a6f2f9a0534933cc999b3845be4344e1af0
# Parent  b6156a08b1def3584647f26096866c1a0c11e54a
build: Disable -march selection from CMakeLists.txt

x32 arch as defined on https://sites.google.com/site/x32abi is neither
X86 nor X64, then forcing -march=i686 leads to build failure as wrong
-march is used.

Forcing -march, -mfloat-abi and -mfpu for ARM is also wrong

As a global sanity sake, disable all forced -march in CMakeLists

Backported from upstream pull request:
https://bitbucket.org/multicoreware/x265/pull-requests/21

Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
[Bernd: rebased for 3.5 based on
 https://gitweb.gentoo.org/repo/gentoo.git/tree/media-libs/x265/files/arm-r1.patch]

diff -r 58dddcf01b7d source/CMakeLists.txt
--- a/source/CMakeLists.txt	Mon Jan 23 09:50:33 2017 +0530
+++ b/source/CMakeLists.txt	Mon Jan 23 21:03:10 2017 +0100
@@ -40,7 +40,7 @@ SET(CMAKE_MODULE_PATH "${PROJECT_SOURCE_
 # System architecture detection
 string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" SYSPROC)
 set(X86_ALIASES x86 i386 i686 x86_64 amd64)
-set(ARM_ALIASES armv6l armv7l aarch64)
+set(ARM_ALIASES armv6l armv6l armv7l armv7a aarch64)
 list(FIND X86_ALIASES "${SYSPROC}" X86MATCH)
 list(FIND ARM_ALIASES "${SYSPROC}" ARMMATCH)
 set(POWER_ALIASES ppc64 ppc64le)
@@ -239,11 +239,7 @@ if(GCC)
         endif()
     endif()
     if(ARM AND CROSS_COMPILE_ARM)
-        if(ARM64)
-            set(ARM_ARGS -fPIC)
-        else()
-            set(ARM_ARGS -march=armv6 -mfloat-abi=soft -mfpu=vfp -marm -fPIC)
-        endif()
+        set(ARM_ARGS -fPIC)
         message(STATUS "cross compile arm")
     elseif(ARM)
         if(ARM64)
@@ -252,10 +248,10 @@ if(GCC)
         else()
             find_package(Neon)
             if(CPU_HAS_NEON)
-                set(ARM_ARGS -mcpu=native -mfloat-abi=hard -mfpu=neon -marm -fPIC)
+                set(ARM_ARGS -mfpu=neon -fPIC)
                 add_definitions(-DHAVE_NEON)
             else()
-                set(ARM_ARGS -mcpu=native -mfloat-abi=hard -mfpu=vfp -marm)
+	        set(ARM_ARGS -fPIC)
             endif()
         endif()
     endif()
--- a/source/dynamicHDR10/CMakeLists.txt
+++ b/source/dynamicHDR10/CMakeLists.txt
@@ -43,14 +43,14 @@ if(GCC)
         endif()
     endif()
     if(ARM AND CROSS_COMPILE_ARM)
-        set(ARM_ARGS -march=armv6 -mfloat-abi=soft -mfpu=vfp -marm -fPIC)
+        set(ARM_ARGS -fPIC)
     elseif(ARM)
         find_package(Neon)
         if(CPU_HAS_NEON)
-            set(ARM_ARGS -mcpu=native -mfloat-abi=hard -mfpu=neon -marm -fPIC)
+            set(ARM_ARGS -fPIC)
             add_definitions(-DHAVE_NEON)
         else()
-            set(ARM_ARGS -mcpu=native -mfloat-abi=hard -mfpu=vfp -marm)
+            set(ARM_ARGS -fPIC)
         endif()
     endif()
     add_definitions(${ARM_ARGS})
@@ -150,4 +150,4 @@ set(BIN_INSTALL_DIR bin CACHE STRING "Install location of executables")
 option(ENABLE_SHARED "Build shared library" OFF)
 
 install(FILES hdr10plus.h DESTINATION include)
-endif()
\ No newline at end of file
+endif()

